<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------



Route::any('api', function () {
    config("app_trace",false);
    $com = input("r");
    $var = input("get.");
    list($r1,$r2,$r3,$r4) = explode(".",$com);
    try{
        $resp = action("$r3/$r4", $var, "api\\$r1\\$r2");
        if(!($resp instanceof  \think\Response)){
            $resp = json($resp);
        }

        return $resp
            ->header([
                "Access-Control-Allow-Origin"=>"*",
            ]);
    }catch (Exception $e){
        return json(["error"=>9000,"msg"=>"接口非法","data"=>$e])
            ->header([
                "Access-Control-Allow-Origin"=>"*",
            ]);
    }
});


Route::get('hello/:name', 'index/hello');
return [
    '/' => 'home/index/index',
    'about-:catId' => 'home/about/index',
    'download-:catId' => 'home/download/index',
    'services-:catId' => 'home/services/index',
    'servicesInfo-:catId-[:id]' => 'home/services/info',
    'system-:catId' => 'home/system/index',
    'news-:catId' => 'home/news/index',
    'newsInfo-:catId-[:id]' => 'home/news/info',
    'team-:catId' => 'home/team/index',
    'contact-:catId' => 'home/contact/index',
    'senmsg' => 'home/index/senmsg',
    'down-:id' => 'home/download/down',
];
